(thoughtful music)
- [Instructor] Let's take a look at my solution
for the challenge to design the H bridge circuit
to control a DC motor.
I began by thinking about whether
each of the transistors would be acting
as a high side switch or a low side switch
connected to the motor.
The top two transistors are both acting
as high side switches because their connected
to the five volt power source
and they control whether or not current flows
down to the motor that's connected below them.
I use PNP transistors to create a high side switch
so both of those top two transistors will be PNP.
The same logic applies to the bottom two transistors.
They're both serving as low side switches
because they're connected
between the motor and ground,
and, since I use NPN transistors
to create low side switches,
both of the bottom transistors will be NPN.
Now I need to figure out how to orient
each of these transistors.
Since the top two transistors are PNP transistors
and current flows down into them
from the five volt source,
they should be oriented
so their emitter terminal is connected
to the power source
and the collector is connected to the motor.
As for the NPN transistors at the bottom,
current flows down from the motor
and passes through them on its way to ground
so the NPN transistors should be oriented
with their emitter terminals connected to ground
and their collector terminals connected to the motor.
Remembering that the arrow
on the transistors symbol
points in the direction of the emitter current
helps me to correctly orient those transistors.
Now, when any of these are turned on
current will flow in
or out of their base terminals
more or less freely.
So, to limit that current
I'll include resistors in series
between the two control signals
and each of the base terminals.
I decided to follow my own rule of thumb
and use one kiloohm resistors
because they'll limit the current
from the control device enough to safely interface
with an Arduino micro controller board.
To check my plan solution
before actually building it on a bread board,
I first consider the case when input A is low,
which means it's connected to ground,
and input B is high at five volts.
Under those conditions
the top left PNP transistors connected to ground
will turn on and act like a closed switch.
And the NPN transistor below it will turn off
so it acts like an open switch.
On the right side with a five volt input signal
the top PNP transistor will be turned off
and the bottom NPN transistor will turn on.
So, with that combination of transistor switches
turned on and off
current will flow into the top left transistor
down through the motor and out
through the bottom right transistor to ground.
Under the opposite conditions,
when input A is at five volts
and input B is connected to ground,
the top left and bottom right transistors
will be turned off
and the top right and bottom left transistors
will be turned on.
So current will flow into the top right transistor
down through the motor and out
through the bottom left transistor to ground.
If both input signals are high at five volts,
then both of the top PNP transistors
will be off, so there's no path
from the five volt source to ground.
And, if both of the input signals are low
and connected to ground,
then both of the bottom NPN transistors
will be off.
So again, there's no path
from the five volt power source down to ground.
Now, to test out that circuit design
I've written a simple Arduino program that rotates
through each of these possible four states
on digital output channel zero and one.
The Arduino program holds
each of these four possible output states
for one second before moving on to the next state
and it will repeat this sequence indefinitely.
I've included the program in the exercise files
as Solution_Arduino_Demo.ino,
which you can use as a reference.
I've built the H bridge circuit on my bread board
using NPN and PNP transistors.
Digital output pin zero from the Arduino
is connected to the right side of the H bridge,
and digital output pin one from the Arduino
is connected to the left side of the H bridge.
I'm measuring the right side input signal
on channel one of my oscilloscope in yellow
and the left side input signal
is shown on channel two in blue.
To verify that my circuit is working correctly
I can compare the input signals
shown on my oscilloscope
to the behavior of the motor.
I see that, when both of the input signals
are either high or low,
the motor stays still,
but, when only the signal for the right side is high,
the motor turns clockwise.
And when only the signal for the left side is high,
it turns counterclockwise.